/*
 * 
 * 
 * 
 */
package com.hboxs.asl.entity;

import com.fasterxml.jackson.annotation.JsonValue;

import javax.persistence.*;
import java.util.HashMap;
import java.util.Map;

/**
 * Entity - 申请删除记录
 */
@Entity
@Table(name = "xx_record")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_record_sequence")
public class Record extends OrderEntity {

    private static final long serialVersionUID = -6109590619198673215L;

    /**
     * 状态
     */
    public enum Status {

        /**
         * 审核中
         */
        reviewing,

        /**
         * 通过
         */
        passed,

        /**
         * 拒绝
         */
        reject;

        private static Map<String, Record.Status> map = new HashMap<>();

        static {
            map.put("审核中", reviewing);
            map.put("通过", passed);
            map.put("拒绝", reject);
        }

        public static Record.Status forValue(String value) {
            return map.get(value);
        }

        @JsonValue
        public String toValue() {
            for (Map.Entry<String, Record.Status> entry : map.entrySet()) {
                if (entry.getValue() == this) {
                    return entry.getKey();
                }
            }

            return "";
        }

        public static Record.Status getDefault() {
            return Record.Status.reviewing;
        }
    }

    /**
     * 删除理由
     */
    private String reason;

    /**
     * 状态
     */
    private Status status;

    /**
     * 教师名称
     */
    private String username;

    /**
     * 课程标题
     */
    private String title;

    /**
     * 课程id
     */
    private Long courseId;

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Long getCourseId() {
        return courseId;
    }

    public void setCourseId(Long courseId) {
        this.courseId = courseId;
    }
}